package cn.stylefeng.guns.weixin.classicCase;

import cn.stylefeng.guns.modular.classicCase.pojo.request.ClassicCaseRequest;
import cn.stylefeng.guns.modular.classicCase.service.ClassicCaseService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 经典案例控制器接口
 *
 * @author liuxue
 * @date 2022/01/10 15:10
 */
@RestController
@ApiResource(name = "经典案例接口")
public class ClassicCaseWxController {

    @Resource
    private ClassicCaseService classicCaseService;


    /**
     * 查看详情
     *
     * @author liuxue
     * @date 2022/01/10 15:10
     */
    @GetResource(name = "查看详情", path = "/wx/classicCase/detail", requiredPermission = false, requiredLogin = false)
    public ResponseData detail(@Validated(ClassicCaseRequest.detail.class) ClassicCaseRequest classicCaseRequest) {
        classicCaseRequest.setStatus(1);
        return new SuccessResponseData(classicCaseService.detail(classicCaseRequest));
    }

    /**
     * 获取列表
     *
     * @author liuxue
     * @date 2022/01/10 15:10
     */
    @GetResource(name = "获取列表", path = "/wx/classicCase/list", requiredPermission = false, requiredLogin = false)
    public ResponseData list(ClassicCaseRequest classicCaseRequest) {
        classicCaseRequest.setStatus(1);
        return new SuccessResponseData(classicCaseService.findList(classicCaseRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author liuxue
     * @date 2022/01/10 15:10
     */
    @GetResource(name = "分页查询", path = "/wx/classicCase/page", requiredPermission = false, requiredLogin = false)
    public ResponseData page(ClassicCaseRequest classicCaseRequest) {
        classicCaseRequest.setStatus(1);
        return new SuccessResponseData(classicCaseService.findPage(classicCaseRequest));
    }



}